package com.xmutca.sso.api.manager.service;

import com.xmutca.core.common.Receipt;
import com.xmutca.core.common.Result;
import com.xmutca.core.common.Results;
import com.xmutca.core.common.exception.ServiceException;
import com.xmutca.sso.api.Account;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import java.util.List;
import java.util.Map;

/**
 * @author: 彭伟煌(pengweihuang@xmutca.com)
 * @create: 2016-08-23 21:36
 */
public interface AccountService {

    /**
     * 获取用户信息
     * @param id
     * @return
     */
    Result<Account> get(String id);

    /**
     * 分配权限
     * @param id
     * @param permissions
     * @return
     */
    Receipt assignPermission(String id, List<Integer> permissions);

    /**
     * 分配角色
     * @param id
     * @param roles
     * @return
     */
    Receipt assignRole(String id, List<Integer> roles);

    /**
     * 回收权限
     * @param id
     * @param permissions
     * @return
     */
    Receipt recoveryPermission(String id, List<Integer> permissions);

    /**
     * 回收角色
     * @param id
     * @param roles
     * @return
     */
    Receipt recoveryRole(String id, List<Integer> roles);

    /**
     * 用户查询
     * @param paramMap
     * @return
     */
    Results<Account> query(@Min(value = 1, message = "页数最小为1") int current, @Max(value = 50, message = "条数最大为50条") int pageSize, Map<String, Object> paramMap);
}
